package edu.xpu.project.user.entity;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;

/**
 * @describe 学生成绩表
 * 			某一个学生在某个科目上的成绩信息
 * @author liukang
 * @date 2017年5月19日
 */
@Entity(name="ScoreEntity")
@Table(name="XPU_SCORE_ENTITY")
@JsonIgnoreProperties(value={"items", "projectUser"})
public class ScoreEntity implements Serializable {

	private static final long serialVersionUID = 2870363162275740777L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	
	private Double scoreTotalVal;				//个人单科成绩
	
	private Double subjectiveItemVal;			//主观题
	
	private Double objectiveItemVal;			//客观题
	
	private Integer classRank;					//班级排名
	
	private Integer gradeRank;					//年纪排名
	
	@OneToMany(mappedBy="scoreEntity", cascade={CascadeType.PERSIST})
	private Set<ScoreItem> items;
	
	
	@ManyToOne(optional=true)
	@JoinColumn(name="course_id")
	private CourseType courseType;			//科目
	
	@ManyToOne(optional=true)
	@JoinColumn(name="student_id")
	private ProjectUser projectUser;		//学生

	public CourseType getCourseType() {
		return courseType;
	}

	public void setCourseType(CourseType courseType) {
		this.courseType = courseType;
	}

	public ProjectUser getProjectUser() {
		return projectUser;
	}

	public void setProjectUser(ProjectUser projectUser) {
		this.projectUser = projectUser;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}

	public Double getScoreTotalVal() {
		return scoreTotalVal;
	}

	public void setScoreTotalVal(Double scoreTotalVal) {
		this.scoreTotalVal = scoreTotalVal;
	}

	public Double getSubjectiveItemVal() {
		return subjectiveItemVal;
	}

	public void setSubjectiveItemVal(Double subjectiveItemVal) {
		this.subjectiveItemVal = subjectiveItemVal;
	}

	public Double getObjectiveItemVal() {
		return objectiveItemVal;
	}

	public void setObjectiveItemVal(Double objectiveItemVal) {
		this.objectiveItemVal = objectiveItemVal;
	}

	public Integer getClassRank() {
		return classRank;
	}

	public void setClassRank(Integer classRank) {
		this.classRank = classRank;
	}

	public Integer getGradeRank() {
		return gradeRank;
	}

	public void setGradeRank(Integer gradeRank) {
		this.gradeRank = gradeRank;
	}

	public Set<ScoreItem> getItems() {
		return items;
	}

	public void setItems(Set<ScoreItem> items) {
		this.items = items;
	}
	
	
}
